package com.tanhua.server.controller;


import com.tanhua.server.service.PeachblossomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;


/**
 * 桃花传音 控制器
 *
 * @author 沈某
 * @date 2021/07/18 09:07:59
 */
@RestController
@RequestMapping("/peachblossom")
public class PeachblossomController {


    @Autowired
    private PeachblossomService peachblossomService;

    /**
     *
     * @param soundFile
     * @return
     * @throws IOException
     */
    @PostMapping(name = "桃花传音-发送语音")
    public ResponseEntity savePeachblossom(MultipartFile soundFile) throws IOException {

        return peachblossomService.savePeachblossom(soundFile);

    }

    /**
     *
     * @return
     */
    @GetMapping(name = "桃花传音-接收语音")
    public ResponseEntity queryPeachblossom() {

        return peachblossomService.queryPeachblossom();

    }

}
